<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 123
  Date: 2022-12-21
  Time: 19:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <base href="${pageContext.request.contextPath}/">
    <link href="css/bootstrap.min.css" rel="stylesheet"/>
    <script src="js/jquery-3.2.1.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <title>商品信息</title>
    <style>
        .father{
            width: 1000px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div class="father">
    <a href="toInsert">新增商品</a>
    <table class="table table-striped table-bordered .table-hover">
        <thead>
        <tr>
            <td colspan="9" style="text-align: center">商品信息</td>
        </tr>
        <tr>
            <td>序号</td>
            <td>商品名称</td>
            <td>分类</td>
            <td>品牌</td>
            <td>型号</td>
            <td>单价</td>
            <td>库存</td>
            <td>评论数</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${commodityPage.records}" var="item">
            <tr>
                <td>${item.cid}</td>
                <td>${item.cname}</td>
                <td>${item.className.className}</td>
                <td>${item.brand.brandName}</td>
                <td>${item.typeName}</td>
                <td>${item.price}</td>
                <td>${item.num}</td>
                <td>${item.count}</td>
                <td><a href="details/${item.cid}">查看详情</a></td>
            </tr>
        </c:forEach>
        </tbody>
        <tfoot>
        <tr>
            <td colspan="9" style="text-align: center">
                <c:if test="${commodityPage.current>1}">
                    <a href="?pageIndex=${commodityPage.current-1}">上一页</a>
                </c:if>
                <c:forEach begin="1" end="${commodityPage.getPages()}" var="item">
                    <a href="?pageIndex=${item}">${item}</a>
                </c:forEach>
                <c:if test="${commodityPage.getPages()>commodityPage.current}">
                    <a href="?pageIndex=${commodityPage.current+1}">下一页</a>
                </c:if>
            </td>
        </tr>
        </tfoot>
    </table>
</div>


</body>
</html>

